package com.xbongbong.paas.service.stage.config;

import com.xbongbong.paas.service.stage.StageSettingsStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Map;
import java.util.stream.Collectors;

/**
 * 阶段设置策略配置
 * @author 李少杰
 * @version v1.0.0
 * @date 2021/11/22 10:59
 */
@Configuration
public class StageSettingsConfig {

    @Autowired
    private Map<String, StageSettingsStrategy> stageSettingsMap;

    @Bean("stageSettingsMap")
    public Map<Integer, StageSettingsStrategy> initStageSettingsMap() {
        return stageSettingsMap.values().stream().collect(Collectors.toMap(StageSettingsStrategy::type, t -> t));
    }
}
